<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础模板</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
       <h3>{{count}}</h3>
       <h3>{{'上个数'+n1}},{{'当前'+n2}},{{'上次计算的结果'+fibo}}</h3>
       <button @click="++count">累加</button>
       <button @click="--count">累减少</button>
       <button @click="increment(5,$event)">累加n</button>
       <button @click="fiboHandle">计算斐波那契数列</button>
    </div>

    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    count: 0,
                    fibo:0,
                    n1:1,
                    n2:1
                }
            },
            methods:{
                increment(n,e){
                    console.log(e);
                    this.count+=n
                },
                fiboHandle(){
                    //计算两个值的结果
                    this.fibo=this.n1+this.n2
                    //将
                    this.n1=this.n2
                    this.n2=this.fibo
                }
            },
        })
    </script>
</body>

</html>